home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / os20 / util / hackdisk202.lha / MakeRes.s < prev   
Text File  |  1993-02-13  |  5KB  |  149 lines

  1.  
  2. ; Program : MakeRes 1.0
  3. ; Date    : end of 1992
  4. ; Author  : G.Nikl
  5. ;
  6. ;   snail mail: Gunther Nikl
  7. ;               Hans-Beimler-Str 17
  8. ;               Parchim
  9. ;               O-2850
  10. ;
  11. ;        email: gnikl@informatik.uni-rostock.de
  12.  
  13. ; MakeRes installs 'HackDisk' by Dan Babcock resident in ram
  14. ; This is done via KickMemPtr & KickMemList so it should work
  15. ; on all systems.Should be called as the first program in the
  16. ; STARTUP-SEQUENCE ( yes the STARTUP-SEQUENCE ) because of a
  17. ; reset we have to do to activate the new trackdisk.device !
  18. ; The RESET is done without any message with the official reset
  19. ; code by Commodore. The program checks first if hackdisk is
  20. ; installed. If so all work is already done. If not we try to
  21. ; load the device from disk ( please place hackdisk in DEVS: ).
  22. ; I wrote this tiny program because i had nothing to install
  23. ; hackdisk.device in my system (Fred Fish deleted the support
  24. ; utility hackdisk was supplied with).
  25. ;
  26. ;   Disclaimer
  27. ;   ~~~~~~~~~~~
  28. ;   The author cannot be held liable for the suitability or accuracy of
  29. ;   this the program.  Any damage directly or indirectly caused by the
  30. ;   use or misuse of this the program is the sole responsibility of the
  31. ;   user her/him self.
  32.  
  33. ; This program and the source are public domain
  34.  
  35. _LVOSupervisor        equ    -30
  36. _LVOAllocMem        equ    -198
  37. _LVOFindName        equ    -276
  38. _LVOCloseLibrary    equ    -414
  39. _LVOOpenLibrary        equ    -552
  40. _LVOSumKickData        equ    -612
  41.  
  42. _LVOLoadSeg        equ    -150
  43. _LVODelay        equ    -198
  44.  
  45. KickMemPtr        equ    546
  46. KickTagPtr        equ    550
  47. KickCheckSum        equ    554
  48.  
  49. main        movea.l 4.w,a6            ; ExecBase
  50.         lea     350(a6),a0        ; DevList
  51.         lea     OldDevice(pc),a1    ; TrackDisk
  52.         jsr     _LVOFindName(a6)
  53.         move.l    d0,a0
  54.         move.l    a0,d0
  55.         beq    nodos
  56.         move.l    24(a0),a0        ; IdString
  57.         lea    NewDevice+5(pc),a1
  58.         moveq    #7,d2
  59. .check        moveq    #$5f,d0
  60.         and.b    (a0)+,d0        ; umwandeln in
  61.         moveq    #$5f,d1
  62.         and.b    (a1)+,d1        ; Kleinbuchstaben
  63.         cmp.b    d0,d1
  64.         dbne    d2,.check        ; weiter vergleichen
  65.         beq    nodos            ; installiert !
  66.         lea     DosName(pc),a1
  67.         moveq   #33,d0
  68.         jsr     _LVOOpenLibrary(a6)    ; DOS oeffen
  69.         movea.l d0,a5
  70.         move.l  a5,d0
  71.         beq     nodos            ; Fehler !
  72.         lea     NewDevice(pc),a1
  73.         move.l  a1,d1
  74.         exg     a6,a5
  75.         jsr     _LVOLoadSeg(a6)        ; Device ueber DOS laden
  76.         exg     a6,a5
  77.         movea.l d0,a3
  78.         move.l  a3,d0
  79.         beq.s   nodev            ; Fehler !
  80.         adda.l  a3,a3
  81.         adda.l  a3,a3
  82.         move.l  -(a3),d3        ; Hunkgroesse
  83.  
  84. ; Eigentlich muessten nur 40 Bytes reserviert werden. Diese liegen dann aber
  85. ; im unguenstigten Fall in einem Bereich der beim Booten! durch ( nur? ) 
  86. ; KickStart 1.2 ueberschrieben wird. Dieser Fall kann eintreten ein, wenn die
  87. ; Startup-Sequence noch vor Ausfuehrung des ersten Befehls abgebrochen wird.
  88. ; Wird nun dieses Programm ausgefuehrt, so wird die KickMemList bei einer
  89. ; Groesse von 40 Bytes in diesem fraglichem Bereich abgelegt. Bevor alle in
  90. ; den KickMemList(s) belegt werden holt sich Exec Speicher, gibt diesen aber
  91. ; teilweise! wieder frei. Dh. man bekommt bei Ausfuehrung dieses Programmes
  92. ; unter Umstaenden schon genutzten Speicher !
  93.  
  94.         moveq   #56,d0
  95.         moveq   #1,d1
  96.         swap    d1
  97.         jsr     _LVOAllocMem(a6)    ; Speicher fuer
  98.                         ; MemList & KickTag
  99.         movea.l d0,a2
  100.         lea     14(a2),a0
  101.         moveq   #2,d2
  102.         move.w  d2,(a0)+        ; Anzahl Entries in MemList
  103.         move.l  a2,(a0)+        ; Adresse der MemList
  104.         moveq   #40,d2
  105.         move.l  d2,(a0)+        ; Groesse der MemList
  106.         move.l  a3,(a0)+        ; Adresse des Devices
  107.         move.l  d3,(a0)+        ; Groesse des Devices
  108.         addq.l  #8,a3            ; richtige Adresse des
  109.         move.l  a3,(a0)            ; Devices eintragen
  110.         move.l  KickTagPtr(a6),4(a0)    ; alten KickTag retten
  111.         beq.s   1$            ; war nichts da
  112.         bset    #31,4(a0)        ; Fortsetzung kennzeichnen
  113. 1$        move.l  a0,KickTagPtr(a6)    ; neuen KickTag eintragen
  114.         move.l  KickMemPtr(a6),d0    ; KickMem belegt ?
  115.         beq.s   2$            ; nein
  116.         move.l  d0,(a2)            ; Nachfolger
  117.         movea.l d0,a0
  118.         move.l  a2,4(a0)        ; Vorgaenger
  119. 2$        move.l  a2,KickMemPtr(a6)    ; neues KickMem eintragen
  120.         jsr     _LVOSumKickData(a6)    ; Checksumme berechnen
  121.         move.l  d0,KickCheckSum(a6)    ; eintragen
  122.         exg     a6,a5
  123.         moveq   #25,d1            : change to suit
  124.         jsr     _LVODelay(a6)        ; 1/2 Sekunde warten
  125.         exg     a6,a5
  126.         lea     $01000004,a4        ; Computer neustarten
  127.         suba.l  -$18(a4),a4
  128.         movea.l (a4),a4
  129.         subq.l  #2,a4
  130.         lea     ResetCode(pc),a5
  131.         jsr     _LVOSupervisor(a6)
  132.         cnop    0,4
  133. ResetCode    reset
  134.         jmp    (a4)
  135.  
  136. nodev        movea.l a5,a1            ; bei Fehler DOS schliessen
  137.         jsr     _LVOCloseLibrary(a6)
  138. nodos        moveq   #0,d0
  139.         rts
  140.  
  141. DosName        dc.b    'dos.library',0
  142.         even
  143. OldDevice    dc.b    'trackdisk.device',0
  144.         even
  145. NewDevice    dc.b    'devs:hackdisk.device',0
  146.         even
  147.  
  148.  
  149.